home *** CD-ROM | disk | FTP | other *** search
- #import "wooddoc.h"
-
- @implementation WoodDoc (WindowDelegate)
-
- - windowWillClose:sender
- {
- int save;
-
- if([self needsSaving] && ![self isEmpty]){
- [window makeKeyAndOrderFront:self];
- if(theOOEClient != nil)
- [self save:self];
- else {
- save = NXRunAlertPanel(localString("Close"),
- localString("%s has changes. Save them?"),
- localString("Save"),
- localString("Don't Save"),
- localString("Cancel"),
- name);
- if(save != NX_ALERTDEFAULT && save != NX_ALERTALTERNATE)
- return nil;
- else {
- [window endEditingFor:self];
- if(save == NX_ALERTDEFAULT){
- if(![self save:nil])
- return nil;
- }
- }
- }
- }
- [self docWillClose_OOE:self];
- [undoManager emptyUndoManager];
- [window setDelegate:nil];
- window = nil;
- if(printInfo)
- [NXApp setPrintInfo:nil];
- return [NXApp freeDoc:self];
- }
-
- - windowDidBecomeMain:sender
- {
- [NXApp setPrintInfo:printInfo];
- [[NXApp inspectorManager] inspect:lastSelectedNode];
- return self;
- }
-
- - windowWillMiniaturize:sender toMiniwindow:counterpart
- {
- char *dot;
- char title[MAXPATHLEN+1];
-
- strcpy(title, [self name]);
- dot = rindex(title, '.');
- if (dot && !strcmp(++dot, [[self class] docExtension]))
- *(--dot) = '\0';
- [counterpart setTitle:title];
- [sender setMiniwindowIcon:"WoodDoc"];
- return self;
- }
-
-
- @end
-